﻿using YKXiangQi.Common;
using YKXiangQi.Enums;

namespace YKXiangQi.Models
{
    public class BoardInfo
    {
        public int Offset { get; set; }
        public int CellSize { get; set; }
        public int PieceSize { get; set; }
        public int Width { get; set; }
        public int Height { get; set; }

        public static BoardInfo FromBoardSize(BoardSize size)
        {
            var result = new BoardInfo();
            switch (size)
            {
                case BoardSize.Large:
                    {
                        result.Offset = Constant.BoardLargeOffset;
                        result.CellSize = Constant.BoardCellLargeSize;
                        result.PieceSize = Constant.PieceMaskLargeSize;
                        result.Width = Constant.BoardLargeWidth;
                        result.Height = Constant.BoardLargeHeight;

                        break;
                    }
                case BoardSize.Medium:
                    {
                        result.Offset = Constant.BoardMediumOffset;
                        result.CellSize = Constant.BoardCellMediumSize;
                        result.PieceSize = Constant.PieceMaskMediumSize;
                        result.Width = Constant.BoardMediumWidth;
                        result.Height = Constant.BoardMediumHeight;

                        break;
                    }
                case BoardSize.Small:
                    {
                        result.Offset = Constant.BoardSmallOffset;
                        result.CellSize = Constant.BoardCellSmallSize;
                        result.PieceSize = Constant.PieceMaskSmallSize;
                        result.Width = Constant.BoardSmallWidth;
                        result.Height = Constant.BoardSmallHeight;

                        break;
                    }
            }
            return result;
        }
    }
}
